<template>
	<!-- 20230417 -->
	<view class="text-top-home-cn">
		
		<!-- 组件内容 -->
		<view class="cn-content">
			<!-- 返回顶部 border-ed  style="line-height: 76rpx;"-->
			<view class="radius-50p bg-f5 text-center" style="width: 80rpx; height: 80rpx;"
				 @click="goTop" v-if="scrollTop > 50">
				<text class="tyIcon-top line-80 text-50 text-33"></text>
			</view>
			
			<!-- 返回首页 -->
			<view class="margin-top-20 radius-50p bg-main text-center" style="width: 80rpx; height: 80rpx;"
				 @click="homeClick" v-if="isShowHome">
				<text class="tyIcon-home line-80 text-50 text-ff"></text>
			</view>
		</view>
		
		<!-- 组件浮层 -->
		<view class="cn-layer">
			
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			// 距离顶部的实时距离
			scrollTop: {
				type: [Number, String],
				default: 0
			},
			// 是否显示返回首页按钮
			isShowHome: {
				type: Boolean,
				default: true
			},
			// 是否显示返回顶部按钮
			isShowTop: {
				type: Boolean,
				default: true
			}
		},
		methods: {
			
			/**
			 * 返回顶部
			 * @param {Object} e
			 * @date 2022-10-12
			 */
			goTop(e) {
				uni.pageScrollTo({
					scrollTop: 0
				});
				this.$emit('topClick')
			},


			/**
			 * 返回顶部
			 * @param {Object} e
			 * @date 2022-10-12
			 */
			homeClick() {
				this.$emit('homeClick')
			}
		}
	}
</script>

<style scoped>

</style>
